package com.liwbn.rbac.controller;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresUser;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class IndexController {

    @RequestMapping("/")
    @RequiresUser
    public String main() {

        System.out.println("当前用户: " + SecurityUtils.getSubject().getPrincipal()
                + ";访问main");
        System.out.println("是否拥有权限main:view: "
                + SecurityUtils.getSubject().isPermitted("main:view"));
        System.out.println("是否拥有权限main:update: "
                + SecurityUtils.getSubject().isPermitted("main:update"));
        return "main";
    }
}
